﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Data;
using System.IO;
using System.Windows.Forms;


namespace weiqijiance.联网通信协议
{
    public class LWbangyuan : LWbass
    {
        public LWbangyuan()
        {
            objdb = new 数据库操作.DBweiqi();
        }
        /// <summary>
        /// 设备状态常量
        /// </summary>
        public const int DEV_FAILURE = -1;   // 设备故障
        public const int DEV_EXIT = 0;        // 设备关机
        public const int DEV_WARMUP = 1;      // 设备预热自检
        public const int DEV_IDLE = 2;        // 空闲
        public const int DEV_WORKING = 3;    // 正在检测

        /// <summary>
        /// 设备状态常量
        /// </summary>
        public const int DETECT_WAITTING = 0;
        public const int DETECT_INSPECT = 1;
        public const int DETECT_FINISH = 2;
        public const int DETECT_CANCLE = 3;
        public const int DETECT_OTHER = 4;

        //        2) 常量定义
        //ASM	稳态工况法
        //LUGD	加载减速工况法
        //TSIC	双怠速检测
        //FRAO	自由加速不透光烟度法
        //FRAF	自由加速滤纸式烟度法
        public string sweb = "";
        public string sTokenGuid = "";
        public string sTokenGuid2 = "";

        /// <summary>
        /// 总调用接口, 用于数据查询或上传。
        /// </summary>
        /// <param name="szFunctionID">函数功能代码（详见5.4功能代码定义）以字符串格式传入</param>
        /// <param name="szParams">对应于当前功能代码的传入参数</param>
        /// <param name="szKeys">调用密钥</param>
        /// <returns><RetVal>  <code></code>  <message></message> <body></body></RetVal>  </returns>
        public string RSInfo(string szFunctionID, string szParams, string szKeys)//总调用接口, 用于数据查询或上传。
        {

            //objmzlpt.Snapshoot(sTokenGuid2, m_mainform.lineCode, long.Parse(sjylsh));

            szKeys = m_mainform.cityCode;
            meizhouby.VESLinkStd2018 objweb = new meizhouby.VESLinkStd2018();
            //meizhoulianwang.VESDetectService objweb = new meizhoulianwang.VESDetectService();
            objweb.Url = m_mainform.surl;
            string sreturn = objweb.RSInfo(szFunctionID, szParams, szKeys);
            
            StreamWriter sw = File.AppendText("./通信协议日志/" + szFunctionID + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt");
            string strsend = string.Format("接口：{0}\r\n协议内容：{1}\r\n调用密钥：{2}\r\n返回值：{3}\r\n", szFunctionID, szParams, szKeys, sreturn);
            sw.WriteLine(strsend);
            sw.Flush();
            sw.Close();
           

            return sreturn;
            //return "";
        }

        public override bool uploadimage(string sjylsh)
        {
            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>",
     sTokenGuid,
     m_mainform.lineCode, sjylsh, 0);
            string sreturn = RSInfo("Snapshoot", sParams, "");
            //System.Threading.Thread.Sleep(1000);
            ////WebReferenceMZL.VESDetectService objmzlpt = new WebReferenceMZL.VESDetectService();
            //meizhoulianwang.VESDetectService objmzlpt = new meizhoulianwang.VESDetectService();
            //objmzlpt.Url = m_mainform.surl;
            ////objmzlpt.Url = m_mainform.surl2;
            //string retf = objmzlpt.Snapshoot(sTokenGuid2, m_mainform.lineCode, long.Parse(sjylsh));

            //StreamWriter sw = File.AppendText("./通信协议日志/联网抓拍" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt");
            //string strsend = string.Format("抓拍发送：{0}\r\n线号：{1}\r\n流水号：{2}\r\n返回值：{3}\r\n", sTokenGuid2, m_mainform.lineCode, sjylsh, retf);
            //sw.WriteLine(strsend);
            //sw.Flush();
            //sw.Close();
            return true;
        }
        public override void init()
        {
            denglu();
        }
        public void denglu()
        {
            {
                string sss = string.Format("  <Params><szUser>{0}</szUser><szPassword>{1}</szPassword></Params>", m_mainform.LWuser, m_mainform.LWpwd);

                string str = RSInfo("Login", sss, "");
                string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                str = stoubao + str;
                XmlDocument xmlstr = new XmlDocument();
                xmlstr.LoadXml(str);
                XmlNodeList sNodeList = xmlstr.SelectNodes("/response/body/Token/TokenInfo");
                if (sNodeList != null)
                {
                    foreach (XmlNode sNode in sNodeList)
                    {
                        sTokenGuid = sNode.Attributes["TokenGuid"].Value;
                    }
                }
            }
            {
                sTokenGuid2 = sTokenGuid;
                //WebReferenceMZL.VESDetectService objmzlpt = new WebReferenceMZL.VESDetectService();
                //objmzlpt.Url = m_mainform.surl2;
                //string str = objmzlpt.Login(m_mainform.LWuser, m_mainform.LWpwd);

                //string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
                //str = stoubao + str;
                //XmlDocument xmlstr = new XmlDocument();
                //xmlstr.LoadXml(str);
                //XmlNodeList sNodeList = xmlstr.SelectNodes("/response/body/Token/TokenInfo");
                //if (sNodeList != null)
                //{
                //    foreach (XmlNode sNode in sNodeList)
                //    {
                //        sTokenGuid2 = sNode.Attributes["TokenGuid"].Value;
                //    }
                //}
            }
            //sss = string.Format("  <Params><user>{0}</user><password>{1}</password></Params>", m_mainform.LWuser, m_mainform.LWpwd);
            //str = RSInfo("getMobilLogin", sss, "");

        }
        public override string JCZT(string szt)
        {
            string sParams = "";
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDevSN>{1}</szDevSN>
  <nState>{2}</nState>
</Params>",
      sTokenGuid,
      m_mainform.lineCode, szt);

            string sreturn = RSInfo("SetDeviceState", sParams, "");
            //RSInfo("SetDeviceState",
            return sreturn;
        }//检测状态
        public override string OBDJC()
        {
            return "";
        }//OBD检测人员

        public override void setclxx(string slsh)//获取车辆信息
        {
            string sql;
            sql = string.Format(@"Select *  from BYclxxex where DETECT_ID='{0}'", slsh);
            DataTable dt = objdb.GetTable(sql);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    baocunCLXX(dt.Rows[i]["AUT_PLATE"].ToString().Trim(), dt.Rows[i]["AUT_PCLASS"].ToString().Trim(), dt.Rows[i]["AUT_EPOWER"].ToString().Trim(), dt.Rows[i]["AUT_REV"].ToString().Trim(), dt.Rows[i]["AUT_MASSRD"].ToString().Trim(), dt.Rows[i]["AUT_VCLASS"].ToString().Trim());//
                }
            }

        }
        public void getcheliangCS()//
        {

            //数据库增加表
            //CREATE TABLE [dbo].[BYclxxex](
            //    [id] [int] IDENTITY(1,1) NOT NULL,
            //    [AUT_PLATE] [varchar](50) NULL,
            //    [AUT_PCLASS] [varchar](50) NULL,
            //    [DETECT_ID] [varchar](50) NULL,
            //    [DET_STATUS] [varchar](50) NULL,
            //    [DET_DATE] [varchar](50) NULL,
            //    [INSPECT_ID] [varchar](50) NULL,
            //    [UNDO_ITEMS] [varchar](50) NULL,
            //    [jcwc] [bit] NULL,
            // CONSTRAINT [PK_BYclxxex] PRIMARY KEY CLUSTERED 
            //(
            //    [id] ASC
            //)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
            //) ON [PRIMARY]
            string sParams = string.Format(@"<Params><szToken>{0}</szToken><szDeviceSN>{1}</szDeviceSN><nInspectType>{2}</nInspectType><nIncrement>{3}</nIncrement></Params>",
sTokenGuid,
m_mainform.lineCode,
0,
0
);
            string sclxx = RSInfo("GetJobList", sParams, "");
            string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
            sclxx = stoubao + sclxx;
            XmlDocument xmlstr = new XmlDocument();
            xmlstr.LoadXml(sclxx);
            XmlNodeList sNodeList = xmlstr.SelectNodes("/response/body/VEHICLELST/VEHICLE");
            if (sNodeList != null)
            {
                foreach (XmlNode sNode in sNodeList)
                {
                    string AUT_PLATE = sNode.Attributes["AUT_PLATE"].Value;
                    string AUT_PCLASS = sNode.Attributes["AUT_PCLASS"].Value;
                    string DETECT_ID = sNode.Attributes["DETECT_ID"].Value;
                    string DET_STATUS = sNode.Attributes["DET_STATUS"].Value;
                    string DET_DATE = sNode.Attributes["DET_DATE"].Value;
                    string INSPECT_ID = sNode.Attributes["INSPECT_ID"].Value;
                    string UNDO_ITEMS = sNode.Attributes["UNDO_ITEMS"].Value;
                    #region
                    string ssql = string.Format("select * from BYclxxex where DETECT_ID='{0}'", DETECT_ID);
                    DataTable dt = objdb.GetTable(ssql);
                    if (dt.Rows.Count < 1)
                    {
                        ssql = string.Format(@"insert into BYclxxex (AUT_PLATE,
AUT_PCLASS,DETECT_ID,DET_STATUS,DET_DATE,INSPECT_ID,UNDO_ITEMS) 
 values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", AUT_PLATE,
    AUT_PCLASS,
    DETECT_ID,
    DET_STATUS,
    DET_DATE,
    INSPECT_ID,
    UNDO_ITEMS
    );
                        m_mainform.objbass.objdb.InsertDB(ssql);
                    }
                    else
                    {
                        //select * from clxxex where cphm='{0}' and hplb='{1}'",
                        ssql = string.Format(@"update BYclxxex set 
AUT_PLATE     ='{0}',
AUT_PCLASS    ='{1}',
DET_STATUS    ='{2}',
DET_DATE      ='{3}',
INSPECT_ID    ='{4}',
UNDO_ITEMS    ='{5}' where DETECT_ID='{6}'", AUT_PLATE,
    AUT_PCLASS,
    DET_STATUS,
    DET_DATE,
    INSPECT_ID,
    UNDO_ITEMS,
    DETECT_ID);
                        m_mainform.objbass.objdb.InsertDB(ssql);
                    }
                    #endregion

                    ssql = string.Format("select * from Detects_SJE where DETECT_ID={0}", DETECT_ID);
                    dt = objdb.GetTable(ssql);
                    if (dt.Rows.Count < 1)
                    {
                        ssql = string.Format(@"insert into Detects_SJE (ASM_JYLSH,PLATE_ID,
PCLASS_ID,DETECT_ID) 
 values ({2},'{0}','{1}',{2})", AUT_PLATE,
    AUT_PCLASS,
    DETECT_ID
    );
                        m_mainform.objbass.objdb.InsertDB(ssql);

                    }
                    else
                    {

                    }
                }
            }
            //RootObject rb = JsonConvert.DeserializeObject<RootObject>(jieguo);
        }
        public override DataTable getjilu(string shphm, string sdatestart, string sdateend, bool bbz)//获取登录车辆上线
        {
            if (!bbz)
            {
                getcheliangCS();
            }
            string sql;
            if (shphm == "")
            {
                sql = string.Format(@" select * from BYclxxex where (jcwcex!=1 or jcwcex is null)  order by id desc");
            }
            else
            {
                sql = string.Format(@" select * from BYclxxex where AUT_PLATE like '%{0}%' order by id desc", shphm);
            }
            //string sfujianqingk = "";
            DataTable dt = objdb.GetTable(sql);
            DataTable dtref = new DataTable();
            dtref.Columns.Add("DETECT_ID");
            dtref.Columns.Add("PLATE_ID");
            dtref.Columns.Add("PCLASS_ID");
            dtref.Columns.Add("jcff");
            dtref.Columns.Add("OBD");
            dtref.Columns.Add("jccs");
            dtref.Columns.Add("zt");
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dtref.NewRow();
                    dr[0] = dt.Rows[i]["DETECT_ID"].ToString().Trim();    //填充第一列的数据 
                    dr[1] = dt.Rows[i]["AUT_PLATE"].ToString().Trim();    //填充第一列的数据 
                    dr[2] = dt.Rows[i]["AUT_PCLASS"].ToString().Trim();    //填充第一列的数据 
                    if (dt.Rows[i]["INSPECT_ID"].ToString().Trim().Contains("TSIC"))
                    {
                        dr[3] = string.Format("双怠速法");
                    }
                    else if (dt.Rows[i]["INSPECT_ID"].ToString().Trim().Contains("ASM"))
                    {
                        dr[3] = string.Format("ASM工况法");
                    }
                    else if (dt.Rows[i]["INSPECT_ID"].ToString().Trim().Contains("LUGD"))
                    {
                        dr[3] = string.Format("加载减速法");
                    }
                    else if (dt.Rows[i]["INSPECT_ID"].ToString().Trim().Contains("FRAO"))
                    {
                        dr[3] = string.Format("自由加速法");
                    }
                    dr[4] = dt.Rows[i]["UNDO_ITEMS"].ToString().Trim();    //填充第一列的数据 
                    dr[5] = string.Format("{0}", "");
                    dr[6] = (dt.Rows[i]["jcwcex"].ToString().ToUpper() == "TRUE") ? "已检" : "未检";
                    dtref.Rows.Add(dr);

                }
            }
            return dtref;
        }

        public override string sendOBDJCJG(string sjylsh)
        {
//            if (System.Windows.Forms.MessageBox.Show("是否提交外观项目？", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
//            {
//                string sParams = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//  <nEventType>{3}</nEventType>
//</Params>
//",
//        sTokenGuid,
//        m_mainform.lineCode, sjylsh, 1);
//                string sreturnw = RSInfo("BeginEvent", sParams, "");

//                string sss = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//<nODOMETER>234</nODOMETER>
//<nVIN_OK>1</nVIN_OK>
//<nEngineNO_OK>1</nEngineNO_OK>
//<nFakePlate_OK>1</nFakePlate_OK>
//<nMechanicalStatus_OK>1</nMechanicalStatus_OK>
//<nPollutionDevice_OK>1</nPollutionDevice_OK>
//<nOilBurningBSmoke_Is>0</nOilBurningBSmoke_Is>
//<nCrankCaseVentilation_OK>1</nCrankCaseVentilation_OK>
//<nFuelEvaporation_OK>1</nFuelEvaporation_OK>
//<nInstrumentation_OK>1</nInstrumentation_OK>
//<nMechanicalProblem_Is>0</nMechanicalProblem_Is>
//<nInletOrExhaustLeak_Is>0</nInletOrExhaustLeak_Is>
//<nEngGearCLiquidLeak_Is>0</nEngGearCLiquidLeak_Is>
//<nHasOBD_OK>{3}</nHasOBD_OK>
//<nTirePressure_OK>1</nTirePressure_OK>
//<nTireDryAndClean_OK>1</nTireDryAndClean_OK>
//<nAirConditionerClose_OK>1</nAirConditionerClose_OK>
//<nInterruptAEEA_OK>1</nInterruptAEEA_OK>
//<nOils_OK>1</nOils_OK>
//<nCheckOnDynamometer_OK>{4}</nCheckOnDynamometer_OK>
//<nCheckResult>1</nCheckResult>
//<szChecker></szChecker>
//</Params>", sTokenGuid,
//         m_mainform.lineCode, sjylsh, m_mainform.sobdshifou, m_mainform.sgkfjc);


//                //            string sss = string.Format(@"<Params>
//                //  <szToken>{0}</szToken>
//                //  <szDeviceSN>{1}</szDeviceSN>
//                //  <lDetectID>{2}</lDetectID>
//                //<nODOMETER>234</nODOMETER>
//                //<nVIN_OK>1</nVIN_OK>
//                //<nEngineNO_OK>1</nEngineNO_OK>
//                //<nFakePlate_OK>1</nFakePlate_OK>
//                //<nMechanicalStatus_OK>0</nMechanicalStatus_OK>
//                //<nPollutionDevice_OK>0</nPollutionDevice_OK>
//                //<nOilBurningBSmoke_Is>0</nOilBurningBSmoke_Is>
//                //<nCrankCaseVentilation_OK>0</nCrankCaseVentilation_OK>
//                //<nFuelEvaporation_OK>0</nFuelEvaporation_OK>
//                //<nInstrumentation_OK>0</nInstrumentation_OK>
//                //<nMechanicalProblem_Is>0</nMechanicalProblem_Is>
//                //<nInletOrExhaustLeak_Is>0</nInletOrExhaustLeak_Is>
//                //<nEngGearCLiquidLeak_Is>0</nEngGearCLiquidLeak_Is>
//                //<nHasOBD_OK>0</nHasOBD_OK>
//                //<nTirePressure_OK>0</nTirePressure_OK>
//                //<nTireDryAndClean_OK>0</nTireDryAndClean_OK>
//                //<nAirConditionerClose_OK>0</nAirConditionerClose_OK>
//                //<nInterruptAEEA_OK>0</nInterruptAEEA_OK>
//                //<nOils_OK>0</nOils_OK>
//                //<nCheckOnDynamometer_OK>0</nCheckOnDynamometer_OK>
//                //<nCheckResult>1</nCheckResult>
//                //<szChecker></szChecker>
//                //</Params>", sTokenGuid,
//                //     m_mainform.lineCode, sjylsh);
//                string str = RSInfo("PutVISInspectData", sss, "");

//                sParams = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//  <nEventType>{3}</nEventType>
//</Params>
//
//",
//         sTokenGuid,
//         m_mainform.lineCode, sjylsh, 1);
//                sreturnw = RSInfo("EndEvent", sParams, "");
//            }
            //-----------------外观上传结束
            string jyksrq = "";
            string jyjsrq = "";
            string obdzdyscqy = "";
            string obdzdyxh = "";
            string vin = "";
            string obdyq = "";
            string bjbz = "";
            string jxxmbz = "";
            string odometer = "";
            string odomil = "";
            string enginecalid = "";
            string enginecvn = "";
            string hclcalid = "";
            string hclcvn = "";

            //查询数据内容
            string sql;
            if (m_mainform.sobdshifou == "1")
            {
                readjcyq();
                sql = string.Format(@"select * from OBD_JCJG  where jylsh ='{0}'  order by OBD_JCJG_ID desc", sjylsh);// DateTime.Now.AddDays(-30), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                #region
                DataTable dt = objdb.GetTable(sql);
                if (dt.Rows.Count > 0)
                {

                    jyksrq = dt.Rows[0]["OBD_JCJG_date"].ToString().Trim();
                    jyjsrq = dt.Rows[0]["OBD_JCJG_date"].ToString().Trim();

                    obdzdyscqy = m_mainform.OBDqiye;
                    obdzdyxh = m_mainform.OBDname;
                    vin = "";
                    obdyq = "EOBD";
                    bjbz = "";
                    for (int i = 0; i < 7; i++)
                    {
                        if (dt.Rows[0][string.Format("OBD_JCJG_GZM{0}", i + 1)].ToString().Trim().Length > 0)
                        {
                            if (bjbz.Length < 1)
                            {
                                bjbz = dt.Rows[0][string.Format("OBD_JCJG_GZM{0}", i + 1)].ToString().Trim();
                            }
                            else
                            {
                                bjbz = bjbz + ";" + dt.Rows[0][string.Format("OBD_JCJG_GZM{0}", i + 1)].ToString().Trim();
                            }
                        }

                    }

                    jxxmbz = "";
                    int igzcount = 0;


                    for (int i = 0; i < 10; i++)
                    {
                        if (dt.Rows[0][string.Format("OBD_JCJG_JXZT{0}", i + 1)].ToString().Trim().Contains("未完成"))
                        {
                            igzcount++;
                            string sjxztwwc = dt.Rows[0][string.Format("OBD_JCJG_JXZT{0}", i + 1)].ToString().Trim();
                            if (sjxztwwc.Contains("SCR"))
                            {
                                jxxmbz += "5,";
                            }
                            else if (sjxztwwc.Contains("POC"))
                            {
                                jxxmbz += "6,";
                            }
                            else if (sjxztwwc.Contains("DOC"))
                            {
                                jxxmbz += "7,";
                            }
                            else if (sjxztwwc.Contains("DPF"))
                            {
                                jxxmbz += "8,";
                            }
                            else if (sjxztwwc.Contains("EGR"))
                            {
                                jxxmbz += "9,";
                            }
                            else if (sjxztwwc.Contains("催化器"))
                            {
                                jxxmbz += "1,";
                            }
                            else if (sjxztwwc.Contains("氧传感器加热器"))
                            {
                                jxxmbz += "3,";
                            }
                            else if (sjxztwwc.Contains("氧传感器"))
                            {
                                jxxmbz += "2,";
                            }
                            else if (sjxztwwc.Contains("可变气门VVT"))
                            {
                                jxxmbz += "4,";
                            }
                            //if (bjbz.Length < 1)
                            //{
                            //    jxxmbz = dt.Rows[0][string.Format("OBD_JCJG_JXZT{0}", i + 1)].ToString().Trim();
                            //}
                            //else
                            //{
                            //    jxxmbz = bjbz + dt.Rows[0][string.Format("OBD_JCJG_JXZT{0}", i + 1)].ToString().Trim();
                            //}
                        }

                    }

                    for (int i = 0; i < 12; i++)
                    {
                        if (dt.Rows[0][string.Format("OBD_JCJG_SJL{0}", i + 1)].ToString().Trim().Contains("里程表"))
                        {

                            odometer = "";// dt.Rows[0][string.Format("OBD_JCJG_SJL{0}", i + 1)].ToString().Trim();

                        }
                        if (dt.Rows[0][string.Format("OBD_JCJG_SJL{0}", i + 1)].ToString().Trim().Contains("点亮后的行驶距离"))
                        {

                            odomil = "";// dt.Rows[0][string.Format("OBD_JCJG_SJL{0}", i + 1)].ToString().Trim();

                            string[] sclxxls = (dt.Rows[0][string.Format("OBD_JCJG_SJL{0}", i + 1)].ToString().Trim().Length > 0) ? dt.Rows[0][string.Format("OBD_JCJG_SJL{0}", i + 1)].ToString().Trim().Split(',') : new string[2] { "", "" };
                            odomil = sclxxls[1];

                        }
                    }
                    if (dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Contains("VIN码"))
                    {
                        string[] sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        vin = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX2"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX2"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        enginecalid = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX3"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX3"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        enginecvn = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX4"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX4"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        hclcalid = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX5"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX5"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        hclcvn = sclxxls[1];

                    }
                    else
                    {
                        string[] sclxxls;// (dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        //vin = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX1"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        enginecalid = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX2"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX2"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        enginecvn = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX3"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX3"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        hclcalid = sclxxls[1];

                        sclxxls = (dt.Rows[0]["OBD_JCJG_CLXX4"].ToString().Trim().Length > 0) ? dt.Rows[0]["OBD_JCJG_CLXX4"].ToString().Trim().Split(',') : new string[2] { "", "" };
                        hclcvn = sclxxls[1];
                    }

                    //for (int i = 0; i < 34; i++)
                    //{
                    //    if (dt.Rows[0][string.Format("OBD_JCJG_IUPR{0}", i + 1)].ToString().Trim().Length > 0)
                    //    {

                    //        //格式化iupr

                    //    }

                    //}

                    string sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>
",
                 sTokenGuid,
                 m_mainform.lineCode, sjylsh, 2);
                    string sreturnw = RSInfo("BeginEvent", sParams, "");

//                    if (sobdsfkq == "否")
//                    {
//                        ///
//                        string ssend = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//  <szVIN>{3}</szVIN>
//  <nMILOK>{4}</nMILOK>
//  <nFaultIndicatorOK>{5}</nFaultIndicatorOK>
//  <nFaultMsgExist>{6}</nFaultMsgExist>
//<nConnect_OK>{7}</nConnect_OK>
//<nConnectKOREASON>{8}</nConnectKOREASON>
//<nODOAfterMIL>{9}</nODOAfterMIL>
//<nNotReadyItemExist>{10}</nNotReadyItemExist>
//<szNotReadyItems>{11}</szNotReadyItems>
//<szENGCALID>{12}</szENGCALID>
//<szENGCVN>{13}</szENGCVN>
//<szPSTPRCSCALID>{14}</szPSTPRCSCALID>
//<szPSTPRCSCVN>{15}</szPSTPRCSCVN>
//<szOTHERCALID>{16}</szOTHERCALID>
//<szOTHERCVN>{17}</szOTHERCVN>
//<szOBD_Checker>{18}</szOBD_Checker>
//<szCheckResult>{19}</szCheckResult>
//<szOBD_CheckRemark>{20}</szOBD_CheckRemark>
//<szFaultCodeAndMsg>{21}</szFaultCodeAndMsg>
//</Params>",
//             sTokenGuid,
//             m_mainform.lineCode,
//                  sjylsh,
//             vin,
//             1,
//             1,
//             "",
//             1,
//             "",
//             odomil,
//             0,
//             "",
//             enginecalid,
//             enginecvn,
//             hclcalid,
//             hclcvn,
//             "",
//             "",
//             "",
//             1,
//             "",
//             "");//

//                        string sreturn = RSInfo("PutOBDInspectData", ssend, "");

//                    }
//                    else
                    {
                        string ssend = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <szVIN>{3}</szVIN>
  <nMILOK>{4}</nMILOK>
  <nFaultIndicatorOK>{5}</nFaultIndicatorOK>
  <nFaultMsgExist>{6}</nFaultMsgExist>
<nConnect_OK>{7}</nConnect_OK>
<nConnectKOREASON>{8}</nConnectKOREASON>
<nODOAfterMIL>{9}</nODOAfterMIL>
<nNotReadyItemExist>{10}</nNotReadyItemExist>
<szNotReadyItems>{11}</szNotReadyItems>
<szENGCALID>{12}</szENGCALID>
<szENGCVN>{13}</szENGCVN>
<szPSTPRCSCALID>{14}</szPSTPRCSCALID>
<szPSTPRCSCVN>{15}</szPSTPRCSCVN>
<szOTHERCALID>{16}</szOTHERCALID>
<szOTHERCVN>{17}</szOTHERCVN>
<szOBD_Checker>{18}</szOBD_Checker>
<szCheckResult>{19}</szCheckResult>
<szOBD_CheckRemark>{20}</szOBD_CheckRemark>
<szFaultCodeAndMsg>{21}</szFaultCodeAndMsg>
</Params>",
             sTokenGuid,
             m_mainform.lineCode,
                  sjylsh,
             vin,
             1,
             1,
             "",
             1,
             "",
             odomil,
             igzcount,
             jxxmbz,
             enginecalid,
             enginecvn,
             hclcalid,
             hclcvn,
             "",
             "",
             "",
             1,
             "",
             bjbz);//

                        string sreturn = RSInfo("PutOBDInspectData", ssend, "");
                    }


                    //str = RSInfo("PutOBDInspectData", sss, "");

                    sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>

",
             sTokenGuid,
             m_mainform.lineCode, sjylsh, 2);
                    sreturnw = RSInfo("EndEvent", sParams, "");

                }
                #endregion
//                else if (sobdsfkq == "否")
//                {

//                    string sParams = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//  <nEventType>{3}</nEventType>
//</Params>
//",
//                 sTokenGuid,
//                 m_mainform.lineCode, sjylsh, 2);
//                    string sreturnw = RSInfo("BeginEvent", sParams, "");

//                    ///
//                    string ssend = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//  <szVIN>{3}</szVIN>
//  <nMILOK>{4}</nMILOK>
//  <nFaultIndicatorOK>{5}</nFaultIndicatorOK>
//  <nFaultMsgExist>{6}</nFaultMsgExist>
//<nConnect_OK>{7}</nConnect_OK>
//<nConnectKOREASON>{8}</nConnectKOREASON>
//<nODOAfterMIL>{9}</nODOAfterMIL>
//<nNotReadyItemExist>{10}</nNotReadyItemExist>
//<szNotReadyItems>{11}</szNotReadyItems>
//<szENGCALID>{12}</szENGCALID>
//<szENGCVN>{13}</szENGCVN>
//<szPSTPRCSCALID>{14}</szPSTPRCSCALID>
//<szPSTPRCSCVN>{15}</szPSTPRCSCVN>
//<szOTHERCALID>{16}</szOTHERCALID>
//<szOTHERCVN>{17}</szOTHERCVN>
//<szOBD_Checker>{18}</szOBD_Checker>
//<szCheckResult>{19}</szCheckResult>
//<szOBD_CheckRemark>{20}</szOBD_CheckRemark>
//<szFaultCodeAndMsg>{21}</szFaultCodeAndMsg>
//</Params>",
//         sTokenGuid,
//         m_mainform.lineCode,
//              sjylsh,
//         vin,
//         1,
//         1,
//         "",
//         1,
//         "",
//         odomil,
//         0,
//         "",
//         enginecalid,
//         enginecvn,
//         hclcalid,
//         hclcvn,
//         "",
//         "",
//         "",
//         1,
//         "",
//         "");//

//                    string sreturn = RSInfo("PutOBDInspectData", ssend, "");



//                    //str = RSInfo("PutOBDInspectData", sss, "");

//                    sParams = string.Format(@"<Params>
//  <szToken>{0}</szToken>
//  <szDeviceSN>{1}</szDeviceSN>
//  <lDetectID>{2}</lDetectID>
//  <nEventType>{3}</nEventType>
//</Params>
//
//",
//             sTokenGuid,
//             m_mainform.lineCode, sjylsh, 2);
//                    sreturnw = RSInfo("EndEvent", sParams, "");

//                }
                else
                {
                    MessageBox.Show("查不到OBD数据，请查询OBD上传是否正确!");
                    return "0";
                }
            }
            return "1";
        }

        public override void getstandxz(string slsh)//获取限值
        {
            //       string sParams = string.Format(@"<Params>  <szToken>{0}</szToken>  <szDeviceSN>{1}</szDeviceSN>  <szPlate>{2}</szPlate>  <szPClass>{3}</szPClass>  <szInspectorID>{4}</szInspectorID>  <szDriverID>{5}</szDriverID></Params>",
            //sTokenGuid,
            //m_mainform.lineCode,
            //szPlate, szPClass, sczy, sycy);
            string sParams = string.Format(@"<Params><szToken>{0}</szToken><szDeviceSN>{1}</szDeviceSN><lDetectID>{2}</lDetectID><szInspectorID>{3}</szInspectorID><szDriverID>{4}</szDriverID></Params>",
     sTokenGuid,
     m_mainform.lineCode,
     slsh, m_mainform.InspectionOperator, m_mainform.InspectionDriver);
            string sreturn = RSInfo("RequestJobByID", sParams, "");
            if (!sreturn.Contains("<code>0</code>"))
            {
                System.Windows.Forms.MessageBox.Show(sreturn);
            }
            string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
            sreturn = stoubao + sreturn;
            XmlDocument xmlstr = new XmlDocument();
            xmlstr.LoadXml(sreturn);
            XmlNodeList sNodeList = xmlstr.SelectNodes("/response/body/InspectInfo/Vehicle");
            if (sNodeList != null)
            {
                foreach (XmlNode sNode in sNodeList)
                {
                    if (sNode.Attributes["INSPECT_ID"].Value.ToString().Trim().Contains("ASM"))
                    {
                        float.TryParse(sNode.Attributes["ASM_COS5025"].Value.ToString().Trim(), out m_mainform.COEL5025);
                        float.TryParse(sNode.Attributes["ASM_HCS5025"].Value.ToString().Trim(), out m_mainform.HCEL5025);
                        float.TryParse(sNode.Attributes["ASM_NOS5025"].Value.ToString().Trim(), out m_mainform.NOEL5025);
                        float.TryParse(sNode.Attributes["ASM_COS2540"].Value.ToString().Trim(), out m_mainform.COEL2540);
                        float.TryParse(sNode.Attributes["ASM_HCS2540"].Value.ToString().Trim(), out m_mainform.HCEL2540);
                        float.TryParse(sNode.Attributes["ASM_NOS2540"].Value.ToString().Trim(), out m_mainform.NOEL2540);
                    }

                    if (sNode.Attributes["INSPECT_ID"].Value.ToString().Trim().Contains("LUGD"))
                    {
                        float.TryParse(sNode.Attributes["LUGD_KS"].Value.ToString().Trim(), out m_mainform.TypeApprovalLimits);
                        float.TryParse(sNode.Attributes["LUGD_NOxS"].Value.ToString().Trim(), out m_mainform.noxlimit);
                        //float.TryParse(sNode.Attributes["LUGD_MAXHPS"].Value.ToString().Trim(),outm_mainform.HCEL5025);
                    }
                    if (sNode.Attributes["INSPECT_ID"].Value.ToString().Trim().Contains("TSIC"))
                    {
                        float.TryParse(sNode.Attributes["TSIC_HCS_H"].Value.ToString().Trim(), out m_mainform.HIHCL);
                        float.TryParse(sNode.Attributes["TSIC_COS_H"].Value.ToString().Trim(), out m_mainform.HICOL);
                        float.TryParse(sNode.Attributes["TSIC_HCS_L"].Value.ToString().Trim(), out m_mainform.LIHCL);
                        float.TryParse(sNode.Attributes["TSIC_COS_L"].Value.ToString().Trim(), out m_mainform.LICOL);
                        float.TryParse(sNode.Attributes["TSIC_AQS_L"].Value.ToString().Trim(), out m_mainform.HCEL5025);
                        float.TryParse(sNode.Attributes["TSIC_AQS_H"].Value.ToString().Trim(), out m_mainform.HCEL5025);
                    }
                    if (sNode.Attributes["INSPECT_ID"].Value.ToString().Trim().Contains("FRAO"))
                    {
                        float.TryParse(sNode.Attributes["FRAO_KS"].Value.ToString().Trim(), out m_mainform.TypeApprovalLimits);
                        float.TryParse(sNode.Attributes["FRAO_KS"].Value.ToString().Trim(), out m_mainform.InspectionLimits);
                    }
                    string ssql = string.Format("update BYclxxex set AUT_EPOWER='{0}',AUT_REV='{1}',AUT_MASSRD='{2}',AUT_VCLASS='{3}' where DETECT_ID='{4}'",
                        sNode.Attributes["AUT_EPOWER"].Value.ToString().Trim(),
                    sNode.Attributes["AUT_REV"].Value.ToString().Trim(),
                    sNode.Attributes["AUT_MASSRD"].Value.ToString().Trim(),
                    sNode.Attributes["AUT_VCLASS"].Value.ToString().Trim(),
                    slsh);
                    m_mainform.objbass.objdb.InsertDB(ssql);

                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(sreturn);
            }
        }

        public override string getuser()
        {
            string sParams = string.Format(@"<Params>  <szToken>{0}</szToken>  <szDevSN>{1}</szDevSN></Params>",
     sTokenGuid,
     m_mainform.lineCode);
            string sreturn = RSInfo("GetInspectorList", sParams, "");
            return sreturn;
        }
        public override void getstandxz(string szPlate, string szPClass, string sycy, string sczy)//获取限值
        {
            string sParams = string.Format(@"<Params>  <szToken>{0}</szToken>  <szDeviceSN>{1}</szDeviceSN>  <szPlate>{2}</szPlate>  <szPClass>{3}</szPClass>  <szInspectorID>{4}</szInspectorID>  <szDriverID>{5}</szDriverID></Params>",
     sTokenGuid,
     m_mainform.lineCode,
     szPlate, szPClass, sczy, sycy);
            string sreturn = RSInfo("RequestJob", sParams, "");

            string stoubao = "<?xml version=\"1.0\" encoding=\"GBK\"?>";
            sreturn = stoubao + sreturn;
            XmlDocument xmlstr = new XmlDocument();
            xmlstr.LoadXml(sreturn);
            XmlNodeList sNodeList = xmlstr.SelectNodes("/response/body/InspectInfo/Vehicle");
            if (sNodeList != null)
            {
                foreach (XmlNode sNode in sNodeList)
                {
                    if (sNode.Attributes["ASM"].Value.ToString().Trim().Contains(""))
                    {
                        float.TryParse(sNode.Attributes["ASM_COS5025"].Value.ToString().Trim(), out m_mainform.COEL5025);
                        float.TryParse(sNode.Attributes["ASM_HCS5025"].Value.ToString().Trim(), out m_mainform.HCEL5025);
                        float.TryParse(sNode.Attributes["ASM_NOS5025"].Value.ToString().Trim(), out m_mainform.NOEL5025);
                        float.TryParse(sNode.Attributes["ASM_COS2540"].Value.ToString().Trim(), out m_mainform.COEL2540);
                        float.TryParse(sNode.Attributes["ASM_HCS2540"].Value.ToString().Trim(), out m_mainform.HCEL2540);
                        float.TryParse(sNode.Attributes["ASM_NOS2540"].Value.ToString().Trim(), out m_mainform.NOEL2540);
                    }

                    if (sNode.Attributes["LUGD"].Value.ToString().Trim().Contains(""))
                    {
                        float.TryParse(sNode.Attributes["LUGD_KS"].Value.ToString().Trim(), out m_mainform.TypeApprovalLimits);
                        float.TryParse(sNode.Attributes["LUGD_NOxS"].Value.ToString().Trim(), out m_mainform.noxlimit);
                        //float.TryParse(sNode.Attributes["LUGD_MAXHPS"].Value.ToString().Trim(),outm_mainform.HCEL5025);
                    }
                    if (sNode.Attributes["TSIC"].Value.ToString().Trim().Contains(""))
                    {
                        float.TryParse(sNode.Attributes["TSIC_HCS_H"].Value.ToString().Trim(), out m_mainform.HIHCL);
                        float.TryParse(sNode.Attributes["TSIC_COS_H"].Value.ToString().Trim(), out m_mainform.HICOL);
                        float.TryParse(sNode.Attributes["TSIC_HCS_L"].Value.ToString().Trim(), out m_mainform.LIHCL);
                        float.TryParse(sNode.Attributes["TSIC_COS_L"].Value.ToString().Trim(), out m_mainform.LICOL);
                        float.TryParse(sNode.Attributes["TSIC_AQS_L"].Value.ToString().Trim(), out m_mainform.HCEL5025);
                        float.TryParse(sNode.Attributes["TSIC_AQS_H"].Value.ToString().Trim(), out m_mainform.HCEL5025);
                    }
                    if (sNode.Attributes["FRAO"].Value.ToString().Trim().Contains(""))
                    {
                        float.TryParse(sNode.Attributes["FRAO_KS"].Value.ToString().Trim(), out m_mainform.InspectionLimits);
                    }
                }
            }
        }


        public override string start(string sjylsh, string stime, string sycy, string sczy, bool bqz)
        {
            string sParams = "";
        /*    sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
  <nCheckResult>1</nCheckResult>
  <CheckLog>
  <EnvCheckResult>
   <fEnvTemperature>22</fEnvTemperature>
<fEnvHumidity>77</fEnvHumidity>
<fEnvPressure>100.4</fEnvPressure>
<nEnvTemperatureOK>1</nEnvTemperatureOK>
<nEnvHumidityOK>1</nEnvHumidityOK>
<nEnvPressureOK>1</nEnvPressureOK>
</EnvCheckResult>
  <GasAnalyMeterZeroCheckResult>  
     <dtZeroBeginTime>{5}</dtZeroBeginTime>
     <dtZeroEndTime>{6}</dtZeroEndTime>
  </GasAnalyMeterZeroCheckResult>
<GasAnalyMeterEnvCheckResult>  
     <fEnviHC>0</fEnviHC>
     <fEnviCO>0</fEnviCO>
<fEnviNOx>0</fEnviNOx>
<nEnviCheckOK>1</nEnviCheckOK>
  </GasAnalyMeterEnvCheckResult>
 <GasAnalyMeterLeftGasCheckResult>  
     <fGasHC>0</fGasHC>
     <fGasCO>0</fGasCO>
<fGasNOx>0</fGasNOx>
<nGasCheckOK>1</nGasCheckOK>
  </GasAnalyMeterLeftGasCheckResult>
   <GasAnalyMeterFlowCheckResult>    
     <nFlowCheckOK>1</nFlowCheckOK>
  </GasAnalyMeterFlowCheckResult>
</CheckLog>
</Params>",
     sTokenGuid,
     m_mainform.lineCode, sjylsh,
     DateTime.Now.AddMinutes(-3).ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.AddMinutes(-4).ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.AddMinutes(-3).ToString("yyyy-MM-dd HH:mm:ss")

     );
            string sreturn2 = RSInfo("PutASMSelfCheckData", sParams, "");
            */

            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode, sjylsh, 3);
            string sreturn = RSInfo("BeginEvent", sParams, "");

            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode, sjylsh, 4);
            sreturn = RSInfo("BeginEvent", sParams, "");

            //            sParams = string.Format(@"<Params>
            //  <szToken>{0}</szToken>
            //  <szDeviceSN>{1}</szDeviceSN>
            //  <lDetectID>{2}</lDetectID>
            //  <nEventType>{3}</nEventType>
            //</Params>
            //",
            //     sTokenGuid,
            //     m_mainform.lineCode, sjylsh, 4);
            //             sreturn = RSInfo("BeginEvent", sParams, "");
            return sreturn;
        }

        public override bool stop(string sjylsh, string jyjg)
        {
            string sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>

",
     sTokenGuid,
     m_mainform.lineCode, sjylsh, 4);
            string sreturn = RSInfo("EndEvent", sParams, "");


            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <nEventType>{3}</nEventType>
</Params>

",
     sTokenGuid,
     m_mainform.lineCode, sjylsh, 3);
            sreturn = RSInfo("EndEvent", sParams, "");
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
</Params>",
    sTokenGuid,
    m_mainform.lineCode, sjylsh);

            sreturn = RSInfo("FinishJob", sParams, "");
            return true;
        }

        public override bool cancel(string sjylsh)
        {
            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
</Params>
", sTokenGuid,
     m_mainform.lineCode, sjylsh);
            string sreturn = RSInfo("CancelJob", sParams, "");
            return true;
        }

        public override void insertjcwc(string slsh)//检测完成标志
        {
            string sqlxzxx = string.Format(@"update BYclxxex set jcwcex=1 where DETECT_ID={0} ", slsh);

            m_mainform.objbass.objdb.InsertDB(sqlxzxx);
        }

        public override string sjuploadASM(string businessId, model.ASM.ASMsj objasmsj, model.ASM.ASMgcsj objasmgcsj, model.ASM.ASMobdgcsj objasmobd, int ics)
        {

            float fcs5025 = 0;//平均车速
            float fcs2540 = 0;
            int icount = 0;
            for (int i = 0; i < objasmgcsj.m_SpeedGCSJ25.Length; i++)
            {
                fcs5025 += objasmgcsj.m_SpeedGCSJ25[i];
                icount++;
            }
            icount = 0;
            for (int j = 0; j < objasmgcsj.m_SpeedGCSJ40.Length; j++)
            {
                fcs2540 += objasmgcsj.m_SpeedGCSJ40[j];
                icount++;
            }
            fcs5025 = fcs5025 / ((float)icount);//平均车速
            fcs2540 = fcs2540 / ((float)icount);
            string sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<fEnvTemperature>{3}</fEnvTemperature>
<fEnvHumidity>{4}</fEnvHumidity>
<fEnvPressure>{5}</fEnvPressure>
<fASM5025CO>{6}</fASM5025CO>
<fASM5025HC>{7}</fASM5025HC>
<fASM5025NO>{8}</fASM5025NO>
<fASM5025Lambda>{9}</fASM5025Lambda>
<fASM5025PowTotal>{10}</fASM5025PowTotal>
<fASM5025Rev>{11}</fASM5025Rev>
<fASM5025Speed>{12}</fASM5025Speed>
<fASM2540CO>{13}</fASM2540CO>
<fASM2540HC>{14}</fASM2540HC>
<fASM2540NO>{15}</fASM2540NO>
<fASM2540Lambda>{16}</fASM2540Lambda>
<fASM2540PowTotal>{17}</fASM2540PowTotal>
<fASM2540Rev>{18}</fASM2540Rev>
<fASM2540Speed>{19}</fASM2540Speed>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     businessId,
     objasmsj.fwendu.ToString(),
                 objasmsj.fshidu.ToString(),
                 objasmsj.fdaqiya.ToString(),
                 objasmsj.fCO25.ToString(),
                 objasmsj.iHC25.ToString(),
                 objasmsj.iNO25.ToString(),
                 objasmsj.lamda25.ToString(),
                 objasmsj.jzzgl5025.ToString(),
                 objasmsj.fdjzs5025.ToString(),
                 fcs5025.ToString(),
     objasmsj.fCO40.ToString(),
     objasmsj.iHC40.ToString(),
     objasmsj.iNO40.ToString(),
     objasmsj.lamda40.ToString(),
     objasmsj.jzzgl2540.ToString(),
                objasmsj.fdjzs2540.ToString(),
                 fcs2540.ToString());


            //过程数据
            //----------------------

            //过程数据
            string s5025 = "";
            string sneirong = "";
            for (int i = 0; i < objasmgcsj.count5025; i++)
            {
                s5025 = string.Format("<Data ID=\"{0}\" V=\"{1}\" F=\"{2}\" REV=\"{3}\" TP=\"{4}\" PP=\"{5}\" IP=\"{6}\" HC=\"{7}\" CO=\"{8}\" NO=\"{9}\" O2=\"{10}\" CO2=\"{11}\" ET=\"{12}\" EP=\"{13}\" EH=\"{14}\" DM=\"{15}\" HM=\"{16}\" Time=\"{17}\" Lambda=\"{18}\" ObdAirInput=\"{19}\" ObdAirPressure=\"{20}\" ObdCLV=\"{21}\" ObdExcessAirFactor=\"{22}\" ObdPreOxygen=\"{23}\" ObdRPM=\"{24}\" ObdSpeed=\"{25}\" ObdThrottle=\"{26}\"/>",
                i + 1,
                objasmgcsj.m_SpeedGCSJ25[i],
                objasmgcsj.m_PWGCSJ25[i],//测功机负载
                objasmgcsj.m_TrunGCSJ25[i],
                objasmgcsj.m_PWGCSJ25[i],//加载功率
                1,//寄生功率
                objasmgcsj.m_PWGCSJ25[i],
                objasmgcsj.m_HCGCSJ25[i],
                objasmgcsj.m_COGCSJ25[i],
                objasmgcsj.m_NOGCSJ25[i],
                objasmgcsj.m_O2GCSJ25[i],
                objasmgcsj.m_CO2GCSJ25[i],
                objasmgcsj.swendu25[i],
                objasmgcsj.sdaqiyi25[i],
                objasmgcsj.sshidu25[i],
                objasmgcsj.m_DFGCSJ25[i],
                objasmgcsj.m_KHGCSJ25[i],
                objasmgcsj.m_ProcessTime25[i],
                objasmgcsj.m_LAMDAGCSJ25[i],
                    objasmobd.ObdAirPressure[i],
                    objasmobd.ObdAirInput[i],
                    objasmobd.ObdRPM[i],
                    objasmobd.ObdSpeed[i],
                    objasmobd.ObdExcessAirFactor[i],
                    objasmobd.ObdPreOxygen[i],
                    objasmobd.ObdCLV[i],
                    objasmobd.ObdThrottle[i]);

                sneirong = sneirong + s5025;
            }

            if (objasmsj.b2540)
            {
                for (int i = 0; i < objasmgcsj.count2540; i++)
                {
                    s5025 = string.Format("<Data ID=\"{0}\" V=\"{1}\" F=\"{2}\" REV=\"{3}\" TP=\"{4}\" PP=\"{5}\" IP=\"{6}\" HC=\"{7}\" CO=\"{8}\" NO=\"{9}\" O2=\"{10}\" CO2=\"{11}\" ET=\"{12}\" EP=\"{13}\" EH=\"{14}\" DM=\"{15}\" HM=\"{16}\" Time=\"{17}\" Lambda=\"{18}\" ObdAirInput=\"{19}\" ObdAirPressure=\"{20}\" ObdCLV=\"{21}\" ObdExcessAirFactor=\"{22}\" ObdPreOxygen=\"{23}\" ObdRPM=\"{24}\" ObdSpeed=\"{25}\" ObdThrottle=\"{26}\"/>",
                    i + objasmgcsj.count5025,
                    objasmgcsj.m_SpeedGCSJ40[i],
                    objasmgcsj.m_PWGCSJ40[i],//测功机负载
                    objasmgcsj.m_TrunGCSJ40[i],
                    objasmgcsj.m_PWGCSJ40[i],//加载功率
                    1,//寄生功率
                    objasmgcsj.m_PWGCSJ40[i],
                    objasmgcsj.m_HCGCSJ40[i],
                    objasmgcsj.m_COGCSJ40[i],
                    objasmgcsj.m_NOGCSJ40[i],
                    objasmgcsj.m_O2GCSJC40[i],
                    objasmgcsj.m_CO2GCSJ40[i],
                    objasmgcsj.swendu40[i],
                    objasmgcsj.sdaqiyi40[i],
                    objasmgcsj.sshidu40[i],
                    objasmgcsj.m_DFGCSJ40[i],
                    objasmgcsj.m_KHGCSJ40[i],
                    objasmgcsj.m_ProcessTime40[i],
                    objasmgcsj.m_LAMDAGCSJ40[i],
                    objasmobd.ObdAirPressure[i + objasmgcsj.count2540],
                    objasmobd.ObdAirInput[i + objasmgcsj.count2540],
                    objasmobd.ObdRPM[i + objasmgcsj.count2540],
                    objasmobd.ObdSpeed[i + objasmgcsj.count2540],
                    objasmobd.ObdExcessAirFactor[i + objasmgcsj.count2540],
                    objasmobd.ObdPreOxygen[i + objasmgcsj.count2540],
                    objasmobd.ObdCLV[i + objasmgcsj.count2540],
                    objasmobd.ObdThrottle[i + objasmgcsj.count2540]);
                    sneirong = sneirong + s5025;
                }
            }
            //--------------------------
            string sLogData = string.Format(" <LogData Count=\"{0}\">{1}</LogData>", (!objasmsj.b2540) ? objasmgcsj.count5025 : (objasmgcsj.count5025 + objasmgcsj.count2540), sneirong);
            string sASM2540 = "";

            if (objasmsj.b2540)
            {
                sASM2540 = string.Format(@" <ASM2540>
     <StageBegin>{0}</StageBegin>     
     <StageEnd>{1}</StageEnd> 
     <SampleBegin>{2}</SampleBegin>
</ASM2540>", objasmgcsj.count5025 + 1, objasmgcsj.count5025 + objasmgcsj.count2540, objasmgcsj.count5025 + 11);
            }
            else
            {
                sASM2540 = string.Format(@" <ASM2540>
     <StageBegin>{0}</StageBegin>     
     <StageEnd>{1}</StageEnd> 
     <SampleBegin>{2}</SampleBegin>
</ASM2540>", 0, 0, 0);
            }
            string sASM5025 = string.Format(@"<ASM5025>
     <StageBegin>{0}</StageBegin>
     <StageEnd>{1}</StageEnd>
     <SampleBegin>{2}</SampleBegin>
     </ASM5025>", 1, objasmgcsj.count5025, 11);

            string sDetectLog = string.Format(@"<DetectLog>  <DetectID>{0}</DetectID>  <InspectID>ASM</InspectID>
  <ASM>{1}</ASM></DetectLog>", businessId, sASM5025 + sASM2540 + sLogData);
            string sszDetectLog = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<szDetectLog>{3}</szDetectLog>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     businessId, sDetectLog);
            string sreturn = RSInfo("PutASMLog", sszDetectLog, "");//发送过程数据
            sreturn = RSInfo("PutASMData", sParams, "");//发送结果数据
            return "1";
        }

        public override string  sjuploadSDS(string businessId, model.SDS.SDSsj objsj, model.SDS.SDSgcsj objgcsj, model.ASM.ASMobdgcsj objasmobd)
        {
            int ilandapd = 1;
            if (objsj.fLAMDAG > 1.05 || objsj.fLAMDAG < 0.95)
            {
                ilandapd = 0;
                objsj.bgood = false;
            }
            string lamda = objsj.fLAMDAG.ToString("0.000");


            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<fEnvTemperature>{3}</fEnvTemperature>
<fEnvHumidity>{4}</fEnvHumidity>
<fEnvPressure>{5}</fEnvPressure>
<fHCH>{6}</fHCH>
<fCOH>{7}</fCOH>
<fHC>{8}</fHC>
<fCO>{9}</fCO>
<fLambda>{10}</fLambda>
</Params>
", sTokenGuid,
     m_mainform.lineCode,
     businessId,
     objsj.fwendu.ToString("0.0"),
     objsj.fshidu.ToString("0.0"),
     objsj.fdaqiya.ToString("0.0"),
     objsj.iHCG.ToString("0"),
     objsj.fCOG.ToString("0.00"),
     objsj.iHCD.ToString("0"),
     objsj.fCOD.ToString("0.00"),
     objsj.fLAMDAG.ToString("0.00")
     );

            //-------------------------------------------------------------------------


            string sdata = "";
            for (int i = 0; i < 30; i++)
            {
                sdata = sdata + string.Format("<Data ID=\"{0}\" REV=\"{1}\" HC=\"{2}\" CO=\"{3}\" CO2=\"{4}\" O2=\"{5}\" Lambda=\"{6}\" Time=\"{7}\" No=\"{8}\" OilTemp=\"{9}\" Temp=\"{10}\" Humi=\"{11}\" Prss=\"{12}\" Stage=\"{13}\" ObdAirInput=\"{14}\" ObdAirPressure=\"{15}\" ObdCLV=\"{16}\" ObdExcessAirFactor=\"{17}\" ObdPreOxygen=\"{18}\" ObdRPM=\"{19}\" ObdSpeed=\"{20}\" ObdThrottle=\"{21}\"/>",
            i + 1,
            objgcsj.m_TrunGCSJG[i],
            objgcsj.m_HCGCSJG[i],
            objgcsj.m_COGCSJG[i],
            objgcsj.m_CO2GCSJG[i],
            objgcsj.m_O2GCSJG[i],
            objgcsj.m_LAMDAGCSJG[i],
            objgcsj.m_ProcessTimeG[i],
            objgcsj.m_NOGCSJG[i],
            objgcsj.syouwenG[i],
            objgcsj.swenduG[i],
            objgcsj.sshiduG[i],
            objgcsj.sdaqiyiG[i],
            1,
                        objasmobd.ObdAirPressure[i + 45],
                        objasmobd.ObdAirInput[i + 45],
                        objasmobd.ObdRPM[i + 45],
                        objasmobd.ObdSpeed[i + 45],
                        objasmobd.ObdExcessAirFactor[i + 45],
                        objasmobd.ObdPreOxygen[i + 45],
                        objasmobd.ObdCLV[i + 45],
                        objasmobd.ObdThrottle[i + 45]);
            }
            if (objgcsj.m_ProcessTimeD[0].Length > 0)
            {
                for (int i = 0; i < 30; i++)
                {
                    sdata = sdata + string.Format("<Data ID=\"{0}\" REV=\"{1}\" HC=\"{2}\" CO=\"{3}\" CO2=\"{4}\" O2=\"{5}\" Lambda=\"{6}\" Time=\"{7}\" No=\"{8}\" OilTemp=\"{9}\" Temp=\"{10}\" Humi=\"{11}\" Prss=\"{12}\" Stage=\"{13}\" ObdAirInput=\"{14}\" ObdAirPressure=\"{15}\" ObdCLV=\"{16}\" ObdExcessAirFactor=\"{17}\" ObdPreOxygen=\"{18}\" ObdRPM=\"{19}\" ObdSpeed=\"{20}\" ObdThrottle=\"{21}\"/>",
                i + 1,
                objgcsj.m_TrunGCSJD[i],
                objgcsj.m_HCGCSJD[i],
                objgcsj.m_COGCSJD[i],
                objgcsj.m_CO2GCSJD[i],
                objgcsj.m_O2GCSJD[i],
                objgcsj.m_LAMDAGCSJD[i],
                objgcsj.m_ProcessTimeD[i],
                objgcsj.m_NOGCSJD[i],
                objgcsj.syouwenD[i],
                objgcsj.swenduD[i],
                objgcsj.sshiduD[i],
                objgcsj.sdaqiyiD[i],
                2,
                            objasmobd.ObdAirPressure[i + 60],
                            objasmobd.ObdAirInput[i + 60],
                            objasmobd.ObdRPM[i + 60],
                            objasmobd.ObdSpeed[i + 60],
                            objasmobd.ObdExcessAirFactor[i + 60],
                            objasmobd.ObdPreOxygen[i + 60],
                            objasmobd.ObdCLV[i + 60],
                            objasmobd.ObdThrottle[i + 60]);
                }
            }

            string sDetectLog = string.Format("<DetectLog>  <DetectID>{0}</DetectID>  <InspectID>TSIC</InspectID>  <TSIC>    <LogData Count=\"{1}\">{2}</LogData>  </TSIC></DetectLog>",
                businessId, (objgcsj.m_ProcessTimeD[0].Length > 0) ? 60 : 30, sdata);
            string sgcsj = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<szDetectLog>{3}</szDetectLog>
</Params>
", sTokenGuid,
     m_mainform.lineCode, businessId, sDetectLog
     );


            string sreturn = RSInfo("PutTSICLog", sgcsj, "");//5.10.3	提交双怠速（怠速）法检测过程日志接口
            sreturn = RSInfo("PutTSICData", sParams, "");//5.11.2	提交双怠速（怠速）法检测结果接口
            return "1";
        }

        public override string  sjuploadZYJS(string businessId, model.ZYJS.ZYJSsj objsj, model.ZYJS.ZYJSgcsj objgcsj, model.LUG.LUGobdgcsj objobdgcsj)
        {

            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<fEnvTemperature>{3}</fEnvTemperature>
<fEnvHumidity>{4}</fEnvHumidity>
<fEnvPressure>{5}</fEnvPressure>
<fK1>{6}</fK1>
<fK2>{7}</fK2>
<fK3>{8}</fK3>
<fK4>{9}</fK4>
<fKAvg>{10}</fKAvg>
<fIdleRev>{11}</fIdleRev>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode,
     businessId,
     objsj.fwendu.ToString("0.00"),
     objsj.fshidu.ToString("0.00"),
     objsj.fdaqiya.ToString("0.00"),
     objsj.SK1.ToString("0.00"),
     objsj.SK2.ToString("0.00"),
     objsj.SK3.ToString("0.00"),
     -1,
    objsj.fSKPJ.ToString("0.00"), objsj.m_SKTurn);
     //objsj.m_SKTurn.ToString("0.00"));
            //---过程数据
            string sdata = "";
            int icountgcsj = 1;
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 13; j++)
                {
                    sdata = sdata + string.Format("<Data ID=\"{0}\" REV=\"{1}\" K=\"{2}\" OilTemp=\"{3}\"/>",
                        icountgcsj++,
                   objgcsj.m_SKGCSJTurn[i, j].ToString(),
                   objgcsj.m_SKGCSJK[i, j].ToString(),
                   objgcsj.m_SKGCSJyw[i, j].ToString());
                }
            }
            string LogData = string.Format(" <LogData Count=\"{0}\">{1}</LogData>", 39, sdata);
            string DetectLog = string.Format(@"<DetectLog>
  <DetectID>{0}</DetectID>
  <InspectID>{1}</InspectID>
<EngRev>{2}</EngRev>
  <InspectTime>{3}</InspectTime>
  <WorkTime>{4}</WorkTime>
  <FRAO>{5}</FRAO>
</DetectLog>", businessId,
             "FRAO",
             objsj.EngRev,
             objsj.InspectTime,
             objsj.WorkTime,
             LogData
             );
            string sjcss = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<szDetectLog>{3}</szDetectLog>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     businessId,
     DetectLog);

            string sreturn;// = RSInfo("PutFRAOData", sParams, "");
            sreturn = RSInfo("PutFRAOLog", sjcss, "");
            sreturn = RSInfo("PutFRAOData", sParams, "");
            return "1";
        }

        public override string  sjuploadLUG(string businessId, model.LUG.LUGsj objsj, model.LUG.LUGgcsj objgcsj, model.LUG.LUGobdgcsj objobdgcsj)
        {
            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<fEnvTemperature>{3}</fEnvTemperature>
<fEnvHumidity>{4}</fEnvHumidity>
<fEnvPressure>{5}</fEnvPressure>
<fK100>{6}</fK100>
<fK80>{7}</fK80>
<fNOx80>{8}</fNOx80>
<fMaxHP>{9}</fMaxHP>
<fMaxHREV>{10}</fMaxHREV>
<fVehMaxHP>{11}</fVehMaxHP>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode,
     businessId,
      objsj.fwendu.ToString("0.00"),
      objsj.fshidu.ToString("0.00"),
      objsj.fdaqiya.ToString("0.00"),
      objsj.m_sk100.ToString("0.00"),
      objsj.m_sk80.ToString("0.00"),
      objsj.m_sno80.ToString("0"),
      objsj.fFindMaxPower.ToString("0"),
      objsj.maxpowerspeed.ToString("0"),
      objsj.zdlbglfdjzs.ToString("0")
     );
            string sss = objgcsj.m_SKGCSJmaxTime[0];
            DateTime datestarttime = new DateTime();
            DateTime.TryParse(sss, out datestarttime);
            //过程数据
            string sdata = "";
            //objgcsj.m_SKGCSJmaxTime[i],
            for (int i = 0; i < objgcsj.imaxcount; i++)
            {
                sdata = sdata + string.Format("<Data ID=\"{0}\" V=\"{1}\" F=\"{2}\" REV=\"{3}\" K=\"{8}\" N=\"{9}\" CO2=\"{10}\" NOx=\"{11}\" OilTemp=\"{12}\" TP=\"{4}\" PP=\"{5}\" IP=\"{6}\" PF=\"{7}\" ET=\"{13}\" EP=\"{14}\" EH=\"{15}\" Time=\"{16}\" ObdThrottlePos=\"{17}\" ObdSpeed=\"{18}\" ObdPower=\"{19}\" ObdRPM=\"{20}\" ObdAirInput=\"{21}\" ObdBoostPressure=\"{22}\" ObdFuelConsumption=\"{23}\" ObdNOx=\"{24}\" ObdSCR=\"{25}\" ObdEGT=\"{26}\" ObdDPF=\"{27}\" ObdEGR=\"{28}\" ObdEFI=\"{29}\"/>",
                    i + 1,
     objgcsj.m_SKGCSJmaxSpeed[i].ToString("0.0"),
     objgcsj.m_SKGCSJmaxForce[i].ToString("0.0"),
     objgcsj.m_SKGCSJmaxTurn[i],
     objgcsj.m_SKGCSJmaxPower[i].ToString("0.0"),
      1,
      ((objgcsj.m_SKGCSJmaxPower[i] - 1)<0)?"0":(objgcsj.m_SKGCSJmaxPower[i] - 1).ToString("0.0"),
     (double.IsInfinity(objgcsj.m_SKGCSJmaxPowerK[i]) || double.IsNaN(objgcsj.m_SKGCSJmaxPowerK[i])) ? "1" : objgcsj.m_SKGCSJmaxPowerK[i].ToString("0.0"),
     objgcsj.m_SKGCSJmaxK[i],
     objgcsj.m_SKGCSJmaxN[i],
     objgcsj.m_SKGCSJmaxco2[i],
     objgcsj.m_SKGCSJmaxNO[i],
     objgcsj.m_SKGCSJmaxyouwen[i],
     objgcsj.m_SKGCSJmaxwendu[i],
     objgcsj.m_SKGCSJmaxdaqiya[i],
     objgcsj.m_SKGCSJmaxshidu[i],
  datestarttime.AddSeconds(i).ToString("yyyy-MM-dd HH:mm:ss"),
                 objobdgcsj.ObdThrottle[i],
                 objobdgcsj.ObdSpeed[i],
                 objobdgcsj.ObdPower[i],
                 objobdgcsj.ObdRPM[i],
                 objobdgcsj.ObdAirInput[i],
                 objobdgcsj.ObdBoostPressure[i],
                 objobdgcsj.ObdFuelConsumption[i],
                 objobdgcsj.ObdNOx[i],
                 objobdgcsj.ObdSCR[i],
                 objobdgcsj.ObdEGT[i],
                 objobdgcsj.ObdDPF[i],
                 objobdgcsj.ObdEGR[i],
                 objobdgcsj.ObdEFI[i]);
            }

            string LogData = string.Format("<LogData Count=\"{0}\">{1}</LogData>", objgcsj.imaxcount, sdata);
            string DetectLog = string.Format(@"<DetectLog>
  <DetectID>{0}</DetectID>
  <InspectID>LUGD</InspectID>
  <LUGD>
    <IdleRev>{1}</IdleRev>
    <MaxHP>{2}</MaxHP>
    <CorrMaxHP>{3}</CorrMaxHP>
    <CalVelMaxHP>{4}</CalVelMaxHP>
    <RealVelMaxHP>{5}</RealVelMaxHP>
    <PowerScanStart>{6}</PowerScanStart>
    <PowerScanEnd>{7}</PowerScanEnd>
    <VelMaxHP100Start>{8}</VelMaxHP100Start>
    <VelMaxHP100End>{9}</VelMaxHP100End>
    <VelMaxHP80Start>{10}</VelMaxHP80Start>
    <VelMaxHP80End>{11}</VelMaxHP80End>
  {12}
  </LUGD>
</DetectLog>",
             businessId,
             objsj.fdjdszs,
             objsj.sczdlbgl.ToString("0.0"),
             objsj.xzzdlbgl.ToString("0.0"),
             objsj.zdlbglsd.ToString("0.0"),
             objsj.zdlbglsjxsd.ToString("0.0"),
            objgcsj.PowerScanStart,
            objgcsj.PowerScanEnd,
            objgcsj.VelMaxHP100Start,
            objgcsj.VelMaxHP100End,
            objgcsj.VelMaxHP80Start,
            objgcsj.VelMaxHP80End,
            LogData);

            string sgcsj = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
<szDetectLog>{3}</szDetectLog>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     businessId,
     DetectLog);

  
            string sreturn="";
            sreturn = RSInfo("PutLUGDData", sParams, "");
            sreturn = RSInfo("PutLUGDLog", sgcsj, "");
            //sreturn = RSInfo("PutLUGDLog", sgcsj, ""); 
            //sreturn = RSInfo("PutLUGDLog", sgcsj2, "");
            //sreturn = RSInfo("PutLUGDLog", sgcsj, "");
            //sjuploadLUG(businessId, objsj, objgcsj, objobdgcsj);
            return "1";

        }
        /// <summary>
        /// 提交设备校准/检定
        /// </summary>
        /// <param name="dtCaliDate">校准/检定日期（yyyy-MM-dd）</param>
        /// <param name="dtCaliValidDate">校准/检定有效截止期（yyyy-MM-dd）</param>
        /// <param name="szCaliSN">校准/检定证书编号</param>
        /// <returns></returns>
        public override string uploadjd(string dtCaliDate, string dtCaliValidDate, string szCaliSN)//提交设备校准/检定(计量检定/校准)信息接口
        {
            string sParams;
            sParams = string.Format(@"<Params>  <szToken>{0}</szToken>  <szDevSN>{1}</szDevSN>  <dtCaliDate>{2}</dtCaliDate>  
<dtCaliValidDate>{3}</dtCaliValidDate><szCaliSN>{4}</szCaliSN></Params>",
     sTokenGuid,
     m_mainform.lineCode,
     dtCaliDate,
     dtCaliValidDate,
     szCaliSN
     );
            string sreturn = RSInfo("PutCalibrationInfo", sParams, "");
            return sreturn;
        }

        public override string jianceqianzj(string sjylsh, model.尾气自检.检测前自检.ziasm objzj)
        {
            string sParams = "";
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
  <nCheckResult>{5}</nCheckResult>
  <CheckLog>
  <EnvCheckResult>
   <fEnvTemperature>{6}</fEnvTemperature>
<fEnvHumidity>{7}</fEnvHumidity>
<fEnvPressure>{8}</fEnvPressure>
<nEnvTemperatureOK>{9}</nEnvTemperatureOK>
<nEnvHumidityOK>{10}</nEnvHumidityOK>
<nEnvPressureOK>{11}</nEnvPressureOK>
</EnvCheckResult>
  <GasAnalyMeterZeroCheckResult>  
     <dtZeroBeginTime>{12}</dtZeroBeginTime>
     <dtZeroEndTime>{13}</dtZeroEndTime>
  </GasAnalyMeterZeroCheckResult>
<GasAnalyMeterEnvCheckResult>  
     <fEnviHC>{14}</fEnviHC>
     <fEnviCO>{15}</fEnviCO>
<fEnviNOx>{16}</fEnviNOx>
<nEnviCheckOK>{17}</nEnviCheckOK>
  </GasAnalyMeterEnvCheckResult>
 <GasAnalyMeterLeftGasCheckResult>  
     <fGasHC>{18}</fGasHC>
     <fGasCO>{19}</fGasCO>
<fGasNOx>{20}</fGasNOx>
<nGasCheckOK>{21}</nGasCheckOK>
  </GasAnalyMeterLeftGasCheckResult>
   <GasAnalyMeterFlowCheckResult>    
     <nFlowCheckOK>{22}</nFlowCheckOK>
  </GasAnalyMeterFlowCheckResult>
</CheckLog>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     sjylsh,
     objzj.dtBeginTime,
objzj.dtEndTime,
objzj.nCheckResult,
objzj.fEnvTemperature,
objzj.fEnvHumidity,
objzj.fEnvPressure,
objzj.nEnvTemperatureOK,
objzj.nEnvHumidityOK,
objzj.nEnvPressureOK,
objzj.dtZeroBeginTime,
objzj.dtZeroEndTime,
objzj.fEnviHC,
objzj.fEnviCO,
objzj.fEnviNOx,
objzj.nEnviCheckOK,
objzj.fGasHC,
objzj.fGasCO,
objzj.fGasNOx,
objzj.fGasCheckOK,
objzj.nFlowCheckOK
     );
            string sreturn2 = RSInfo("PutASMSelfCheckData", sParams, "");

            return "成功";
        }

        public override string jianceqianzj(string sjylsh, model.尾气自检.检测前自检.zijiansds objzj)
        {
            string sParams = "";
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
  <nCheckResult>{5}</nCheckResult>
  <CheckLog>
  <EnvCheckResult>
   <fEnvTemperature>{6}</fEnvTemperature>
<fEnvHumidity>{7}</fEnvHumidity>
<fEnvPressure>{8}</fEnvPressure>
<nEnvTemperatureOK>{9}</nEnvTemperatureOK>
<nEnvHumidityOK>{10}</nEnvHumidityOK>
<nEnvPressureOK>{11}</nEnvPressureOK>
</EnvCheckResult>
  <GasAnalyMeterZeroCheckResult>  
     <dtZeroBeginTime>{12}</dtZeroBeginTime>
     <dtZeroEndTime>{13}</dtZeroEndTime>
  </GasAnalyMeterZeroCheckResult>
<GasAnalyMeterEnvCheckResult>  
     <fEnviHC>{14}</fEnviHC>
     <fEnviCO>{15}</fEnviCO>
<fEnviNOx>{16}</fEnviNOx>
<nEnviCheckOK>{17}</nEnviCheckOK>
  </GasAnalyMeterEnvCheckResult>
 <GasAnalyMeterLeftGasCheckResult>  
     <fGasHC>{18}</fGasHC>
     <fGasCO>{19}</fGasCO>
<fGasNOx>{20}</fGasNOx>
<nGasCheckOK>{21}</nGasCheckOK>
  </GasAnalyMeterLeftGasCheckResult>
   <GasAnalyMeterFlowCheckResult>    
     <nFlowCheckOK>{22}</nFlowCheckOK>
  </GasAnalyMeterFlowCheckResult>
</CheckLog>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     sjylsh,
     objzj.dtBeginTime,
objzj.dtEndTime,
objzj.nCheckResult,
objzj.fEnvTemperature,
objzj.fEnvHumidity,
objzj.fEnvPressure,
objzj.nEnvTemperatureOK,
objzj.nEnvHumidityOK,
objzj.nEnvPressureOK,
objzj.dtZeroBeginTime,
objzj.dtZeroEndTime,
objzj.fEnviHC,
objzj.fEnviCO,
objzj.fEnviNOx,
objzj.nEnviCheckOK,
objzj.fGasHC,
objzj.fGasCO,
objzj.fGasNOx,
objzj.fGasCheckOK,
objzj.nFlowCheckOK
     );
            string sreturn2 = RSInfo("PutTSICSelfCheckData", sParams, "");

            return "成功";
        }

        public override string jianceqianzj(string sjylsh, model.尾气自检.检测前自检.zijianlug objzj)
        {
            string sParams = "";
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
  <nCheckResult>{5}</nCheckResult>
  <CheckLog>
  <EnvCheckResult> 
   <fEnvTemperature>{6}</fEnvTemperature>
<fEnvHumidity>{7}</fEnvHumidity>
<fEnvPressure>{8}</fEnvPressure>
<nEnvTemperatureOK>{9}</nEnvTemperatureOK>
<nEnvHumidityOK>{10}</nEnvHumidityOK>
<nEnvPressureOK>{11}</nEnvPressureOK>
</EnvCheckResult>
  <OilTemperatureCheckResult>  
     <dtOilTmpCheckBeginTime>{12}</dtOilTmpCheckBeginTime>
     <dtOilTmpCheckEndTime>{13}</dtOilTmpCheckEndTime>
     <fOilTemperature>{14}</fOilTemperature>
<nOilTemperatureResult>{15}</nOilTemperatureResult>
  </OilTemperatureCheckResult>
<OpaciMeterCheckResult>  
     <fKCheckP0Point>{16}</fKCheckP0Point>
     <fKCheckP100Point>{17}</fKCheckP100Point>
<nKCheckP0PointOK>{18}</nKCheckP0PointOK>
<nKCheckP100PointOK>{19}</nKCheckP100PointOK>
  </OpaciMeterCheckResult>
</CheckLog>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode,
     sjylsh,
objzj.dtBeginTime,
objzj.dtEndTime,
objzj.nCheckResult,
objzj.fEnvTemperature,
objzj.fEnvHumidity,
objzj.fEnvPressure,
objzj.nEnvTemperatureOK,
objzj.nEnvHumidityOK,
objzj.nEnvPressureOK,
objzj.dtOilTmpCheckBeginTime,
objzj.dtOilTmpCheckEndTime,
objzj.fOilTemperature,
objzj.nOilTemperatureResult,
objzj.fKCheckP0Point,
objzj.fKCheckP100Point,
objzj.nKCheckP0PointOK,
objzj.nKCheckP100PointOK
     );
            string sreturn2 = RSInfo("PutLUGDSelfCheckData", sParams, "");

            return "成功";
        }

        public override string jianceqianzj(string sjylsh, model.尾气自检.检测前自检.zijianzyjs objzj)
        {
            string sParams = "";
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <lDetectID>{2}</lDetectID>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
  <nCheckResult>{5}</nCheckResult>
  <CheckLog>
  <EnvCheckResult> 
   <fEnvTemperature>{6}</fEnvTemperature>
<fEnvHumidity>{7}</fEnvHumidity>
<fEnvPressure>{8}</fEnvPressure>
<nEnvTemperatureOK>{9}</nEnvTemperatureOK>
<nEnvHumidityOK>{10}</nEnvHumidityOK>
<nEnvPressureOK>{11}</nEnvPressureOK>
</EnvCheckResult>
  <OilTemperatureCheckResult>  
     <dtOilTmpCheckBeginTime>{12}</dtOilTmpCheckBeginTime>
     <dtOilTmpCheckEndTime>{13}</dtOilTmpCheckEndTime>
     <fOilTemperature>{14}</fOilTemperature>
<nOilTemperatureResult>{15}</nOilTemperatureResult>
  </OilTemperatureCheckResult>
<OpaciMeterCheckResult>  
     <fKCheckP0Point>{16}</fKCheckP0Point>
     <fKCheckP100Point>{17}</fKCheckP100Point>
<nKCheckP0PointOK>{18}</nKCheckP0PointOK>
<nKCheckP100PointOK>{19}</nKCheckP100PointOK>
  </OpaciMeterCheckResult>
</CheckLog>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode,
     sjylsh,
objzj.dtBeginTime,
objzj.dtEndTime,
objzj.nCheckResult,
objzj.fEnvTemperature,
objzj.fEnvHumidity,
objzj.fEnvPressure,
objzj.nEnvTemperatureOK,
objzj.nEnvHumidityOK,
objzj.nEnvPressureOK,
objzj.dtOilTmpCheckBeginTime,
objzj.dtOilTmpCheckEndTime,
objzj.fOilTemperature,
objzj.nOilTemperatureResult,
objzj.fKCheckP0Point,
objzj.fKCheckP100Point,
objzj.nKCheckP0PointOK,
objzj.nKCheckP100PointOK
     );
            string sreturn2 = RSInfo("PutFRAOSelfCheckData", sParams, "");

            return "成功";
        }
        public override string uploadhxjc(model.尾气自检.hxjc objhxjc)//日常滑行测试结束后提交滑行结果
        {
            string sParams;
            string DailySlipLog;
            string SlipLoadingPWLog;
            string Data;
            Data = string.Format("<Data ID=\"{0}\" Speed=\"{1}\" BeginV=\"{2}\" EndV=\"{3}\" LossPW=\"{10}\" LoadPW=\"{4}\" TheoretialTime=\"{5}\" ActualTime=\"{6}\" RatioResult=\"{7}\" Limit=\"{8}\" JudgeResult=\"{9}\"/>",
                0,
    objhxjc.Speed,
    objhxjc.BeginV40,
    objhxjc.EndV40,
    objhxjc.LoadPW40,
    objhxjc.TheoretialTime40,
    objhxjc.ActualTime40,
    objhxjc.RatioResult40, 1,
    objhxjc.JudgeResult40, 0.77f);
            Data = Data + string.Format("<Data ID=\"{0}\" Speed=\"{1}\" BeginV=\"{2}\" EndV=\"{3}\" LossPW=\"{10}\" LoadPW=\"{4}\" TheoretialTime=\"{5}\" ActualTime=\"{6}\" RatioResult=\"{7}\" Limit=\"{8}\" JudgeResult=\"{9}\"/>",
                1,
    objhxjc.Speed2,
    objhxjc.BeginV25,
    objhxjc.EndV25,
    objhxjc.LoadPW25,
    objhxjc.TheoretialTime25,
    objhxjc.ActualTime25,
    objhxjc.RatioResult25, 1,
    objhxjc.JudgeResult25, 0.45);

    //        Data = string.Format("<Data ID=\"{0}\" Speed=\"{1}\" BeginV=\"{2}\" EndV=\"{3}\" LossPW=\"{10}\" LoadPW=\"{4}\" TheoretialTime=\"{5}\" ActualTime=\"{6}\" RatioResult=\"{7}\" Limit=\"{8}\" JudgeResult=\"{9}\"/>",
    //            0,
    //objhxjc.Speed,
    //objhxjc.BeginV40,
    //objhxjc.EndV40,
    //objhxjc.LoadPW40,
    //6.25,
    //6.54,
    //0.05, 0.07,
    //1, 0.86f);
    //        Data = Data + string.Format("<Data ID=\"{0}\" Speed=\"{1}\" BeginV=\"{2}\" EndV=\"{3}\" LossPW=\"{10}\" LoadPW=\"{4}\" TheoretialTime=\"{5}\" ActualTime=\"{6}\" RatioResult=\"{7}\" Limit=\"{8}\" JudgeResult=\"{9}\"/>",
    //            1,
    //objhxjc.Speed2,
    //objhxjc.BeginV25,
    //objhxjc.EndV25,
    //objhxjc.LoadPW25,
    //4.09,
    //3.9,
    //-0.05, 0.07,
    //1, 0.39);
            SlipLoadingPWLog = string.Format("<SlipLoadingPWLog Count=\"{0}\">{1}</SlipLoadingPWLog>", 2, Data);
            DailySlipLog = string.Format(@"<DailySlipLog>  
<CheckDate>{0}</CheckDate>  
<DeviceSN>{1}</DeviceSN> 
<nDIW>{2}</nDIW>  
<fPowerI>{3}</fPowerI>
{4}</DailySlipLog>",
   objhxjc.CheckDate,
   m_mainform.lineCode,
   objhxjc.fDIW,
   10,
   SlipLoadingPWLog);

//            DailySlipLog = string.Format(@"<DailySlipLog>  
//<CheckDate>{0}</CheckDate>  
//<DeviceSN>{1}</DeviceSN> 
//<nDIW>{2}</nDIW>  
//<fPowerI>{3}</fPowerI>
//{4}</DailySlipLog>",
//   objhxjc.CheckDate,
//   m_mainform.lineCode,
//   1100,
//   10,
//   SlipLoadingPWLog);

            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
<szDeviceType>{2}</szDeviceType>
<szSlipType>{8}</szSlipType>
  <dtCheckDate>{3}</dtCheckDate>
  <dtBeginTime>{4}</dtBeginTime>
  <dtEndTime>{5}</dtEndTime>
  <szCheckLog>{6}</szCheckLog>
<nJudgeResult>{7}</nJudgeResult>
<szRemark></szRemark>
</Params>",
     "",
     m_mainform.lineCode,
     objhxjc.scyqy,
     objhxjc.dtCheckDate,
  objhxjc.dtBeginTime,
  objhxjc.dtEndTime,
  DailySlipLog,
  1,0);
            string sreturn = RSInfo("PutDailyCheckDynamometerLoadingPWSlip", sParams, "");
            return sreturn;
        }


        public override string uploadzj(model.尾气自检.xljc objxljc)//日常检查泄露检查结束后提交检查结果
        {
            

            
            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <dtCheckDate>{2}</dtCheckDate>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
<nJudgeResult>{5}</nJudgeResult>
<szRemark>{6}</szRemark>
</Params>
",
     sTokenGuid,
     m_mainform.lineCode,
     objxljc.dtCheckDate,
     objxljc.dtBeginTime,
     objxljc.dtEndTime,
     objxljc.nJudegeResult,
     objxljc.szRemark
     );
            string sreturn = "";
            if (objxljc.syq == "1")
            {
                sreturn = RSInfo("PutDailyCheckGasAnalyMeterLeak", sParams, "");
            }
            else
            {
                sreturn = RSInfo("PutDailyCheckNOxGasAnalyMeterLeak", sParams, "");
            }
            return sreturn;
        }

        public override string uploadzj(model.尾气自检.yliangcheng objxljc)//5.6.4	废气分析仪氧量程检查
        {
            string sParams;
            sParams = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <dtCheckDate>{2}</dtCheckDate>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
<CheckVal>{5}</CheckVal>
<StdVal>{6}</StdVal>
<DivVal>{7}</DivVal>
<nJudgeResult>{8}</nJudgeResult>
<szRemark>{9}</szRemark>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     objxljc.dtCheckDate,
     objxljc.dtBeginTime,
     objxljc.dtEndTime,
     objxljc.CheckVal,
     objxljc.StdVal,
     objxljc.DivVal,
      objxljc.nJudgeResult,
      "");

            string sreturn = RSInfo("PutDailyCheckGasAnalyMeterCheckO2", sParams, "");
            return sreturn;
        }


        public override string uploadzj(model.尾气自检.fqyddjc objxljc)//废气分析仪单点检查
        {

            string sdata = string.Format("<Data GasType=\"HC\" CheckVal=\"{0}\" StdVal=\"{1}\" RateVal=\"{2}\" DivVal=\"{3}\" CheckJudge=\"{4}\" T10Val=\"{5}\" T10Std=\"{6}\" T10Judge=\"{7}\" T90Val=\"{8}\" T90Std=\"{9}\" T90Judge=\"{10}\" JudgeResult=\"{11}\"/>",
            objxljc.CheckValHC,
            objxljc.StdValHC,
            objxljc.RateValHC,
            objxljc.DivValHC,
            objxljc.CheckJudgeHC,
            objxljc.T10ValHC,
            objxljc.T10StdHC,
            objxljc.T10JudgeHC,
            objxljc.T90ValHC,
            objxljc.T90StdHC,
            objxljc.T90JudgeHC,
            objxljc.JudgeResultHC);
            sdata = sdata + string.Format("<Data GasType=\"CO\" CheckVal=\"{0}\" StdVal=\"{1}\" RateVal=\"{2}\" DivVal=\"{3}\" CheckJudge=\"{4}\" T10Val=\"{5}\" T10Std=\"{6}\" T10Judge=\"{7}\" T90Val=\"{8}\" T90Std=\"{9}\" T90Judge=\"{10}\" JudgeResult=\"{11}\"/>",
        objxljc.CheckValCO,
        objxljc.StdValCO,
        objxljc.RateValCO,
        objxljc.DivValCO,
        objxljc.CheckJudgeCO,
        objxljc.T10ValCO,
        objxljc.T10StdCO,
        objxljc.T10JudgeCO,
        objxljc.T90ValCO,
        objxljc.T90StdCO,
        objxljc.T90JudgeCO,
        objxljc.JudgeResultCO);
            sdata = sdata + string.Format("<Data GasType=\"NO\" CheckVal=\"{0}\" StdVal=\"{1}\" RateVal=\"{2}\" DivVal=\"{3}\" CheckJudge=\"{4}\" T10Val=\"{5}\" T10Std=\"{6}\" T10Judge=\"{7}\" T90Val=\"{8}\" T90Std=\"{9}\" T90Judge=\"{10}\" JudgeResult=\"{11}\"/>",
        objxljc.CheckValNO,
        objxljc.StdValNO,
        objxljc.RateValNO,
        objxljc.DivValNO,
        objxljc.CheckJudgeNO,
        objxljc.T10ValNO,
        objxljc.T10StdNO,
        objxljc.T10JudgeNO,
        objxljc.T90ValNO,
        objxljc.T90StdNO,
        objxljc.T90JudgeNO,
        objxljc.JudgeResultNO);
            sdata = sdata + string.Format("<Data GasType=\"CO2\" CheckVal=\"{0}\" StdVal=\"{1}\" RateVal=\"{2}\" DivVal=\"{3}\" CheckJudge=\"{4}\" T10Val=\"{5}\" T10Std=\"{6}\" T10Judge=\"{7}\" T90Val=\"{8}\" T90Std=\"{9}\" T90Judge=\"{10}\" JudgeResult=\"{11}\"/>",
objxljc.CheckValCO2,
objxljc.StdValCO2,
objxljc.RateValCO2,
objxljc.DivValCO2,
objxljc.CheckJudgeCO2,
objxljc.T10ValCO2,
objxljc.T10StdCO2,
objxljc.T10JudgeCO2,
objxljc.T90ValCO2,
objxljc.T90StdCO2,
objxljc.T90JudgeCO2,
objxljc.JudgeResultCO2);

            string GasAnalyzerCheckLog = string.Format("<GasAnalyzerCheckLog><CheckDate>{0}</CheckDate><DeviceSN>{1}</DeviceSN><CheckType>{2}</CheckType><PEF>{3}</PEF><CheckPointLog Count=\"4\" JudgeResult=\"2\">{4}</CheckPointLog></GasAnalyzerCheckLog>",
                objxljc.dtCheckDate,
                m_mainform.lineCode,
            2,
            objxljc.PEF,
            sdata);
            string Params = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <dtCheckDate>{2}</dtCheckDate>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
<szCheckLog>{5}</szCheckLog>
<nJudgeResult>{6}</nJudgeResult>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     objxljc.dtCheckDate,
     objxljc.dtBeginTime,
     objxljc.dtEndTime,
     GasAnalyzerCheckLog,
     1);
            string sreturn = RSInfo("PutDailyCheckGasAnalyMeterSinglePoint", Params, "");
            return sreturn;
        }


        public override string uploadzj(model.尾气自检.btgydjjc objxljc)//不透光NS值
        {
           string sdata = "";//
            int icount=0;
            if(objxljc.CheckVal30.Trim().Length>0)
            {
                  sdata= sdata+string.Format(" <Data CheckType=\"{0}\" CheckVal=\"{1}\" StdVal=\"{2}\" AbsoluteVal=\"{3}\" AbsoluteJudge=\"{4}\"/>",
                      "30%",
                      objxljc.CheckVal30,
                      objxljc.StdVal30,
                      objxljc.AbssoluteVal30,
                      objxljc.AbssoluteJudge30);
                icount++;

            }
            
            if(objxljc.CheckVal50.Trim().Length>0)
            {
                  sdata=sdata+ string.Format(" <Data CheckType=\"{0}\" CheckVal=\"{1}\" StdVal=\"{2}\" AbsoluteVal=\"{3}\" AbsoluteJudge=\"{4}\"/>",
                      "50%",
                      objxljc.CheckVal50,
                      objxljc.StdVal50,
                      objxljc.AbssoluteVal50,
                      objxljc.AbssoluteJudge50);
                icount++;

            }
            
            if(objxljc.CheckVal70.Trim().Length>0)
            {
                  sdata=sdata+ string.Format(" <Data CheckType=\"{0}\" CheckVal=\"{1}\" StdVal=\"{2}\" AbsoluteVal=\"{3}\" AbsoluteJudge=\"{4}\"/>",
                      "70%",
                      objxljc.CheckVal70,
                      objxljc.StdVal70,
                      objxljc.AbssoluteVal70,
                      objxljc.AbssoluteJudge70);
                icount++;

            }
            string sdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string sCheckPointLog=string.Format("<CheckPointLog Count=\"{1}\" JudgeResult=\"{2}\">{0}</CheckPointLog>",sdata,icount,1);
            string sOpaciMeterCheckLog = string.Format(@"<OpaciMeterCheckLog>
<CheckDate>{1}</CheckDate>
  <DeviceSN>{2}</DeviceSN>
<CheckV0>{3}</CheckV0>
<DivV0>{4}</DivV0>
<CheckV0Judge>{5}</CheckV0Judge>
<CheckV100>{6}</CheckV100>
<DivV100>{7}</DivV100>
<CheckV0Judge>{8}</CheckV0Judge>
{0}
</OpaciMeterCheckLog>", sCheckPointLog, sdate, m_mainform.lineCode,
                      0, 0, 1, 100, 0, 1);



            string Params = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <dtCheckDate>{2}</dtCheckDate>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
<szCheckLog>{5}</szCheckLog>
<nJudgeResult>{6}</nJudgeResult>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     DateTime.Now.AddMinutes(-5).ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.AddMinutes(-5).ToString("yyyy-MM-dd HH:mm:ss"),
     sdate,
     sOpaciMeterCheckLog,
     1);
            string sreturn = RSInfo("PutDailyCheckOpaciMeterSinglePoint", Params, "");
            return sreturn;
        }


        public override string uploadzj(model.尾气自检.btgnoxyqjd objxljc)//NOx分析仪单点检查后提交检查结果。
        {
            string sdata = "";//
            int icount = 0;
            sdata = sdata + string.Format(" <Data GasType=\"NO\" CheckVal=\"{0}\" StdVal=\"{1}\" RateVal=\"{2}\" DivVal=\"{3}\" CheckJudge=\"{4}\" T10Val=\"0\" T10Std=\"0\" T10Judge=\"0\" T90Val=\"0\" T90Std=\"0\" T90Judge=\"0\"  JudgeResult=\"1\"/>",
                 objxljc.CheckValNO,
                 objxljc.StdValNO,
                 objxljc.RateValNO,
                 objxljc.DivValNO,
                 objxljc.CheckJudgeNO);

            //sdata = sdata + string.Format(" <Data GasType=\"NO2\" CheckVal=\"{0}\" StdVal=\"{1}\" RateVal=\"{2}\" DivVal=\"{3}\" CheckJudge=\"{4}\" T10Val=\"0\" T10Std=\"0\" T10Judge=\"0\" T90Val==\"0\" T90Std=\"0\" T90Judge==\"0\"  JudgeResult=\"1\"/>",
            //     objxljc.CheckValNO2,
            //     objxljc.StdValNO2,
            //     objxljc.RateValNO2,
            //     objxljc.DivValNO2,
            //     objxljc.CheckJudgeNO2);
            string sdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string sNOxAnalyzerCheckLog = string.Format("<CheckPointLog Count=\"1\" JudgeResult=\"2\">{0}</CheckPointLog>", sdata);
            string NOxAnalyzerCheckLog = string.Format(@"<NOxAnalyzerCheckLog>
<CheckDate>{1}</CheckDate>
  <DeviceSN>{2}</DeviceSN>
  <CheckType>{3}</CheckType>{0}
</NOxAnalyzerCheckLog>
", sNOxAnalyzerCheckLog, sdate, m_mainform.lineCode,
                      2);



            string Params = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <dtCheckDate>{2}</dtCheckDate>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
<szCheckLog>{5}</szCheckLog>
<nJudgeResult>{6}</nJudgeResult>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     DateTime.Now.AddMinutes(-5).ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.AddMinutes(-5).ToString("yyyy-MM-dd HH:mm:ss"),
     sdate,
     NOxAnalyzerCheckLog,
     1);
            string sreturn = RSInfo("PutDailyCheckNOxAnalyMeterSinglePoint", Params, "");
            return sreturn;
        }


        public override string uploadzj(model.尾气自检.dzqxzzijian objxljc)//5.5.11	电子气象站日常检查（日常检查项目）
        {
            string sdata = "";//
            int icount = 0;
            sdata = sdata + string.Format(@"<WeatherStationCheckLog>
<CheckDate>{0}</CheckDate>
  <DeviceSN>{1}</DeviceSN>
  <CheckTempVal>{2}</CheckTempVal>
  <StdTempVal>{3}</StdTempVal>
  <RateTempVal>{4}</RateTempVal>
  <RateJudgeTemp>{5}</RateJudgeTemp>
  <CheckPressVal>{6}</CheckPressVal>
  <StdPressVal>{7}</StdPressVal>
  <RatePressVal>{8}</RatePressVal>
  <RateJudgePress>{9}</RateJudgePress>
<CheckHumiVal>{10}</CheckHumiVal>
  <StdHumiVal>{11}</StdHumiVal>
  <RateHumiVal>{12}</RateHumiVal>
  <RateJudgeHumi>{13}</RateJudgeHumi>
</WeatherStationCheckLog>", DateTime.Now.AddSeconds(-10).ToString("yyyy-MM-dd HH:mm:ss"),
m_mainform.lineCode,
objxljc.CheckTempVal,
objxljc.StdTempVal,
objxljc.RateTempVal,
objxljc.RateJudgeTemp,
objxljc.CheckPressVal,
objxljc.StdPressVal,
objxljc.RatePressVal,
objxljc.RateJudgePress,
objxljc.CheckHumiVal,
objxljc.StdHumiVal,
objxljc.RateHumiVal,
objxljc.RateJudgeHumi);

            string Params = string.Format(@"<Params>
  <szToken>{0}</szToken>
  <szDeviceSN>{1}</szDeviceSN>
  <dtCheckDate>{2}</dtCheckDate>
  <dtBeginTime>{3}</dtBeginTime>
  <dtEndTime>{4}</dtEndTime>
<szCheckLog>{5}</szCheckLog>
<nJudgeResult>{6}</nJudgeResult>
</Params>",
     sTokenGuid,
     m_mainform.lineCode,
     DateTime.Now.AddSeconds(-10).ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.AddSeconds(-10).ToString("yyyy-MM-dd HH:mm:ss"),
     DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
     sdata,
     1);
            string sreturn = RSInfo("PutDailyCheckWeatherStation", Params, "");
            return sreturn;
        }
    }
}
